﻿namespace Sidvall.FileSystemManager.Net.Services.V1
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
    public sealed partial class CleanConfig : global::Sidvall.Data.ServiceDataRowBase, global::Sidvall.FileSystemManager.Data.ICleanConfig
    {
        #region Public Members

        #region CleanBackupFolders

        private bool _CleanBackupFolders;
        partial void OnBeforeCleanBackupFoldersPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterCleanBackupFoldersPropertyChanged();
        public bool CleanBackupFolders
        { 
            get
            {
                return _CleanBackupFolders;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _CleanBackupFolders = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _CleanBackupFolders);
                    OnBeforeCleanBackupFoldersPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("CleanBackupFolders", eventData.Value, true, true);
                        OnAfterCleanBackupFoldersPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region CleanBuildFolders

        private bool _CleanBuildFolders;
        partial void OnBeforeCleanBuildFoldersPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterCleanBuildFoldersPropertyChanged();
        public bool CleanBuildFolders
        { 
            get
            {
                return _CleanBuildFolders;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _CleanBuildFolders = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _CleanBuildFolders);
                    OnBeforeCleanBuildFoldersPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("CleanBuildFolders", eventData.Value, true, true);
                        OnAfterCleanBuildFoldersPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region CleanConfigId

        private System.Nullable<int> _CleanConfigId;
        partial void OnBeforeCleanConfigIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<int>> eventData);
        partial void OnAfterCleanConfigIdPropertyChanged();
        public System.Nullable<int> CleanConfigId
        { 
            get
            {
                return _CleanConfigId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _CleanConfigId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<int>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<int>>(value, _CleanConfigId);
                    OnBeforeCleanConfigIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("CleanConfigId", eventData.Value, true, true);
                        OnAfterCleanConfigIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region CleanPackageFolder

        private bool _CleanPackageFolder;
        partial void OnBeforeCleanPackageFolderPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterCleanPackageFolderPropertyChanged();
        public bool CleanPackageFolder
        { 
            get
            {
                return _CleanPackageFolder;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _CleanPackageFolder = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _CleanPackageFolder);
                    OnBeforeCleanPackageFolderPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("CleanPackageFolder", eventData.Value, true, true);
                        OnAfterCleanPackageFolderPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region FolderPath

        private string _FolderPath;
        partial void OnBeforeFolderPathPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterFolderPathPropertyChanged();
        public string FolderPath
        { 
            get
            {
                return _FolderPath;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _FolderPath = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _FolderPath);
                    OnBeforeFolderPathPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("FolderPath", eventData.Value, true, true);
                        OnAfterFolderPathPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RemoveSourceControlLinks

        private bool _RemoveSourceControlLinks;
        partial void OnBeforeRemoveSourceControlLinksPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRemoveSourceControlLinksPropertyChanged();
        public bool RemoveSourceControlLinks
        { 
            get
            {
                return _RemoveSourceControlLinks;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RemoveSourceControlLinks = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RemoveSourceControlLinks);
                    OnBeforeRemoveSourceControlLinksPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RemoveSourceControlLinks", eventData.Value, true, true);
                        OnAfterRemoveSourceControlLinksPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.DataRowStateIsDirty(this);
            }
        }

        #endregion
        #region LoadInstanceField

        public void LoadInstanceField(string fieldName, object value, bool cascade, bool updateState)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.LoadInstanceField(this, fieldName, value, cascade, false, updateState);
        }

        #endregion
        #region Copy

        public CleanConfig Copy()
        {
            return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Copy(this);
        }
        public CleanConfig Copy(Sidvall.Data.CopySettings settings)
        {
            return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Copy(this, settings);
        }

        #endregion
        #region Import

        public void Import(global::Sidvall.FileSystemManager.Data.ICleanConfig item)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Import(this, item);
        }
        public void Import(global::Sidvall.FileSystemManager.Data.ICleanConfig item, Sidvall.Data.CopySettings settings)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Import(this, item, settings);
        }

        #endregion
        #region ValidateAsync

        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync()
        {
            return await global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.ValidateAsync(this).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync(Sidvall.Data.ValidationSettings settings)
        {
            return await global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.ValidateAsync(this, settings).ConfigureAwait(false);
        }

        #endregion
        #region Initialize

        public void Initialize()
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Initialize(this);
        }
        public void Initialize(Sidvall.Data.InitializeSettings settings)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Initialize(this, settings);
        }

        #endregion

        #region ICleanConfig Members

        bool global::Sidvall.FileSystemManager.Data.ICleanConfig.CleanBackupFolders
        {
            get
            {
                return this._CleanBackupFolders;
            }
            set
            {
                this._CleanBackupFolders = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.ICleanConfig.CleanBuildFolders
        {
            get
            {
                return this._CleanBuildFolders;
            }
            set
            {
                this._CleanBuildFolders = value;
            }
        }
        System.Nullable<int> global::Sidvall.FileSystemManager.Data.ICleanConfig.CleanConfigId
        {
            get
            {
                return this._CleanConfigId;
            }
            set
            {
                this._CleanConfigId = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.ICleanConfig.CleanPackageFolder
        {
            get
            {
                return this._CleanPackageFolder;
            }
            set
            {
                this._CleanPackageFolder = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.ICleanConfig.FolderPath
        {
            get
            {
                return this._FolderPath;
            }
            set
            {
                this._FolderPath = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.ICleanConfig.RemoveSourceControlLinks
        {
            get
            {
                return this._RemoveSourceControlLinks;
            }
            set
            {
                this._RemoveSourceControlLinks = value;
            }
        }

        #endregion

        #endregion
        #region Constructors

        public CleanConfig()
        {
        }
        public CleanConfig(bool initializeDefaultValues)
            : this(initializeDefaultValues, null, Sidvall.Business.BusinessEvents.None)
        {
        }
        public CleanConfig(bool initializeDefaultValues, Sidvall.Data.DataRowState? dataRowState, Sidvall.Business.BusinessEvents enabledBusinessEvents)
            : base(dataRowState, enabledBusinessEvents)
        {
            if (initializeDefaultValues)
                global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.CleanConfigManager.Initialize(this);
        }

        #endregion
    }
}